package top.yxqz.resp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Mr.余
 * @date 2022/11/18
 * @package top.yxqz.resp
 * 解决中文乱码
 */
@WebServlet("/demo2")
public class RespDemo2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //        解决乱码
        response.setContentType("text/html;charset=utf-8");
//          响应中文数据
        response.getWriter().println("你好，世界");

    }
}
